package net.kunyv.base.controller;


import net.kunyv.base.service.SysUserRoleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 角色管理Controller
 *
 * @author wenq
 * @date 2018-03-13
 */
@Controller
@RequestMapping(value = "/SysUserRole")
public class SysUserRoleController {

    @Resource
    private SysUserRoleService sysUserRoleService;
    Logger logger = LoggerFactory.getLogger(SysUserRoleController.class);

    /**
     * 获取全部的用户
     *
     * @return
     * @author wenq
     * @date 2018-03-13
     */
    @ResponseBody
    @RequiresPermissions("role:query")
    @RequestMapping(value = "/selectNotHaveUser")
    public List selectNotHaveUser(String roleId, String userName) {
        return sysUserRoleService.selectNotHaveUser(roleId, userName);
    }

    /**
     * 根据roleId获取用户
     *
     * @return
     * @author wenq
     * @date 2018-03-13
     */
    @ResponseBody
    @RequiresPermissions("role:query")
    @RequestMapping(value = "/selectRoleUser")
    public List selectRoleUser(String roleId) {
        return sysUserRoleService.selectRoleUser(roleId);
    }

}
